# Maintainer: Ray Donnelly <mingw.android@gmail.com>

_realname=luatex
pkgbase=mingw-w64-${_realname}-svn
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.0
pkgrel=1
url="https://foundry.supelec.fr/projects/luatex"
arch=('any')
makedepends=('svn')
# source=(xetex-code::git+https://git.code.sf.net/p/xetex/code)
source=('0001-Add-missing-kpathsea-win32-mktex.h-and-mkpaths.c.patch')
sha256sums=('ccea3666272e90f13c8cdbde0d03005f65f259984fef8adf26c377df84ecaa96')
_svntrunk=https://foundry.supelec.fr/svn/luatex/trunk

prepare() {
  msg "Connecting to $_svntrunk SVN server...."
  if [[ -d ${_realname}/.svn ]]; then
    (cd ${_realname} && svn up --username anonsvn --password anonsvn)
  else
    svn co --username anonsvn --password anonsvn $_svntrunk --config-dir ./ ${_realname}
  fi
  # [[ -d ${_realname}/source/src/texk/texlive ]] && rm -rf ${_realname}/source/src/texk/texlive
  # cp -rf xetex-code/source/texk/texlive ${_realname}/source/src/texk/
  patch -p1 -i "${srcdir}"/0001-Add-missing-kpathsea-win32-mktex.h-and-mkpaths.c.patch
}

build() {
  [[ -d build-${CARCH} ]] && rm -rf build-${CARCH}
  mv "${srcdir}"/${_realname} build-${CARCH}
  cd build-${CARCH}
  ./build.sh
}

package() {
  msg "lol"
}
